/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.bc;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.tesoreria.bc.RealizarPagoLocal;
import org.cip.esymons.tesoreria.be.DocumentoPago;

/**
 *
 * @author Cristian
 */
public class RealizarPagoDelegate {

    private RealizarPagoLocal local;

    public RealizarPagoDelegate() {
        local=lookupRealizarPagoBeanLocal();
    }

    public void reporteCert(DocumentoPago docPago) {
        try{
        local.reporteCert(docPago);
        }catch(Exception e){
            local=lookupRealizarPagoBeanLocal();
        }
    }

    private RealizarPagoLocal lookupRealizarPagoBeanLocal() {
        try {
            Context c = new InitialContext();
            return (RealizarPagoLocal) c.lookup("java:comp/env/RealizarPagoBean");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }

    

}
